﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace HotelManagement.PL.FunctionControl
{
	public partial class BaseUserControl : UserControl
	{
		#region Constructor
		public BaseUserControl()
		{
			InitializeComponent();
		}
		#endregion

		#region Public Method
		/// <summary>
		/// clear the control's status.
		/// </summary>
		public virtual void Clear()
		{
			if (this.Controls == null || this.Controls.Count == 0)
			{
				return;
			}
			foreach (Control control in this.Controls)
			{
				if (control is TextBox)
				{
					((TextBox)control).Text = string.Empty;
				}
				else if (control is DataGrid)
				{
					((DataGrid)control).DataSource = null;
				}
			}
		}

		/// <summary>
		/// update goods's status.
		/// </summary>
		public void OnUpdateGoodsStatus()
		{
			UpdateGoodsEvent UpdateGoodsEventHandlerTemp = UpdateGoodsEventHandler;
			if (UpdateGoodsEventHandlerTemp != null)
			{
				UpdateGoodsEventHandlerTemp();
			}
		}
		#endregion

		#region Delegate and Event
		public delegate void UpdateGoodsEvent();
		public event UpdateGoodsEvent UpdateGoodsEventHandler;
		#endregion
	}
}
